package me.fung.wubi.app.view.editor

/**
 * w 重码数
 * l 词长度
 * cl 编码长度
 * 数字：9表示其它长度
 */
data class Filter(
    val value: String = "",

    val w1: Boolean = true,
    val w2: Boolean = true,
    val w3: Boolean = true,
    val w9: Boolean = true,

    val l1: Boolean = true,
    val l2: Boolean = true,
    val l3: Boolean = true,
    val l4: Boolean = true,
    val l9: Boolean = true,

    val cl1: Boolean = true,
    val cl2: Boolean = true,
    val cl3: Boolean = true,
    val cl4: Boolean = true,
    val cl9: Boolean = true,

    val onlyShort: Boolean = false,
    val minWF: Int = 0,
    val maxWF: Int = 0,
) {
    fun wList(): List<Int> = ArrayList<Int>().apply {
        if (w1) add(1)
        if (w2) add(2)
        if (w3) add(3)
        if (w9) add(9)
    }

    fun lList(): List<Int> = ArrayList<Int>().apply {
        if (l1) add(1)
        if (l2) add(2)
        if (l3) add(3)
        if (l4) add(4)
        if (l9) add(9)
    }

    fun clList(): List<Int> = ArrayList<Int>().apply {

        if (cl1) add(1)
        if (cl2) add(2)
        if (cl3) add(3)
        if (cl4) add(4)
        if (cl9) add(9)
    }
}